package com.sn.author.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2020/10/16 11:04
 * @Version 1.0.0
 * @Description <>
 **/
@Getter
public enum IMEnum {
    TEXT_TYPE(10,"文本"),
    VIDEO_TYPE(20,"视频"),
    CARD_TYPE(30,"名片");

    private Integer type;

    private String desc;

    IMEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static Optional<IMEnum> match(Integer type) {
        return Arrays.stream(IMEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
